package com.mall.shop.entity.product;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.List;

/**
 * 商品三级分类()表实体类
 *
 * @author 龙茶清欢
 * @since 2023-01-16 15:11:28
 */
@Getter
@Setter
@TableName("pms_category")
@Schema(name = "商品三级分类实体", description = "商品三级分类映射")
public class Category implements Serializable {
    private static final long serialVersionUID = 943167578818787609L;

    @TableId(value = "cat_id" , type = IdType.AUTO)
    @Schema(description = "分类id")
    private Long catId;

    @TableField(value = "name")
    @Schema(description = "分类名称")
    private String name;
    
    @TableField(value = "parent_cid")
    @Schema(description = "父分类id")
    private Long parentCid;
    
    @TableField(value = "cat_level")
    @Schema(description = "层级")
    private Integer catLevel;
    
    @TableField(value = "show_status")
    @Schema(description = "是否显示[0-不显示，1显示]")
    private Integer showStatus;
    
    @TableField(value = "sort")
    @Schema(description = "排序")
    private Integer sort;
    
    @TableField(value = "icon")
    @Schema(description = "图标地址")
    private String icon;
    
    @TableField(value = "product_unit")
    @Schema(description = "计量单位")
    private String productUnit;
    
    @TableField(value = "product_count")
    @Schema(description = "商品数量")
    private Integer productCount;

    // 当这个字段为空时不返回这个字段
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    @TableField(exist = false)
    private List<Category> children;
}

